# Title     : TODO
# Objective : TODO
# Created by: Administrator
# Created on: 2020/10/15 0015

x <- c(134, 146, 106, 119, 124, 161, 107, 83, 113, 129, 97, 123)
y <- c(170, 118, 101, 185, 107, 132, 94, 83, 113, 129, 97, 123)




#x,y ：为进行检验的数据。
#alternative：该参数设定备择假设，默认为双尾检验。
#mu：单样本检验时，需要设定的平均值。
#paired：为逻辑参数，是否进行配对t-test。
#var.equal：双样本检验时，总体方差是否相等
#conf.level：设定显著性水平，默认α=0.05。
#t.test(x, y = NULL,
#      alternative = c("two.sided", "less", "greater"),
#      mu = 0, paired = FALSE, var.equal = FALSE,
#      conf.level = 0.95, ...)
#df自由度
#t 检验值


library("ggpubr")
library("car")
#mydata <- data.frame(weight=c(x,y),group=rep(1:2,each = 12))
#p <- ggboxplot(mydata, x = "group", y = "weight",
#               color = "group", palette = "jco",add = "jitter",
#               short.panel.labs = FALSE)+
# # stat_compare_means(method = "t.test")+
#  stat_compare_means(aes(label = ..p.signif..),method = "wilcox.test")
#p
#wilcox.test(x,y,paired = T)

set.seed(2)
a <- rnorm(100,mean = 20,sd=2)
b <- rnorm(100,mean = 20,sd=3)
value <- c(a,b)
group <- rep(letters[1:2],each=100)

data <- data.frame(value,group)

leveneTest(value~group,data=data)
bartlett.test(value~group,data=data)

ggboxplot(data,x="group",y="value")